@extends('admin.common.main')
@section('css')
    {{--  引入webuploader css 异步文件上传  --}}
    <link rel="stylesheet" type="text/css" href="/webuploader/webuploader.css">
@endsection
@section('cnt')
    <nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i> 首页
        <span class="c-gray en">&gt;</span> 预约管理
        <span class="c-gray en">&gt;</span> 预约信息添加
        <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
           href="javascript:location.replace(location.href);" title="刷新">
            <i class="Hui-iconfont">&#xe68f;</i>
        </a>
    </nav>

    <article class="page-container">

        @include('admin.common.msg')
        @include('admin.common.validate')

        <form action="{{ route('admin.notice.store') }}" class="form form-horizontal" method="post"
              id="form-member-add">
            @csrf

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">
                    <span class="c-red">*</span>房东：
                </label>
                <div class="formControls col-xs-8 col-sm-9">
                    <select name="fangowner_id">
                        @foreach($owner as $item)
                            <option value="{{ $item->id }}">{{ $item->name }}</option>
                        @endforeach
                    </select>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">
                    <span class="c-red">*</span>租客：
                </label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" name="renting_id" value="1">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">
                    <span class="c-red">*</span>预约信息：
                </label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" name="cnt" value="丰都中学见面">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">
                    <span class="c-red">*</span>预约时间：
                </label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input autocomplete="off" type="text"
                           onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                           style="width: 200px" class="input-text Wdate" name="book_time">
                </div>
            </div>

            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-primary radius" type="submit" value="添加节点">
                </div>
            </div>
        </form>
    </article>
@endsection

@section('js')
    {{-- webuploader js 异步文件上传 --}}
    <script type="text/javascript" src="/webuploader/webuploader.js"></script>
    <script type="text/javascript" src="/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
    <script src="/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
    <script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/validate-methods.js"></script>
    <script type="text/javascript" src="/admin/lib/jquery.validation/1.14.0/messages_zh.js"></script>
    <script>

        $("#form-member-add").validate({
            rules: {
                fangowner_id: {
                    required: true
                },
                renting_id: {
                    required: true
                },
                cnt: {
                    // 密码一致 需是ID
                    required: true
                },
                book_time: {
                    // 密码一致 需是ID
                    required: true
                },
            },
            onkeyup: false,
            success: "valid",
            submitHandler: function (form) {
                // 验证成功 提交表单
                form.submit();
            },
        });

    </script>
@endsection
